import translator
import unittest

SAMPLES_DIR = '..\\samples\\'
SINGLE_HAND_FILE = 'singlehand.txt'

class TestTranslator(unittest.TestCase):
    
    def testmultifiles(self):
        hands = translator.translatefiles(SAMPLES_DIR)           
        self.assertEqual(len(hands), 6)
    
    def testsinglehand(self):
        hand = translator.translatefile(SAMPLES_DIR, SINGLE_HAND_FILE)
        h = hand[0]
        self.assertEqual(len(h.players), 5)
        self.assertEqual(len(h.actions), 14)
        self.assertEqual(h.sb, '1')
        self.assertEqual(h.bb, '2')
        self.assertEqual(h.id, '37707345940')
        self.assertEqual(h.table_name, 'Doris III')
        self.assert_('Kd' in h.dealt)
        self.assert_(('2', 'mixmastr', '$315') in h.players)
        self.assert_(('Tranqville', 'calls',  '$10') in h.actions)
        
if __name__ == '__main__':
    unittest.main()